package cn.zymall.common.utils.amqp;

import cn.zymall.common.model.BaseEntity;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

/**
 * @author xuxianda
 * @Description: 消息队列工具类
 * @date 2020/8/18 19:48
 * @Copyright
 * @return
 **/
@Component
public class AMQPUtil {
    /**
     * 需要在配置文件中配置rabbitMQ连接信息才能自动注入
     */
    @Autowired
    AmqpTemplate amqpTemplate;

    /**
     * @return
     * @desc 发送消息
     */
    public void sendMsg(String queueName, String msg) {
        amqpTemplate.convertAndSend(queueName, msg);
    }
}
